package com.graduation.smartparkingplatform.ServiceImpl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.graduation.smartparkingplatform.Dao.ChargingMapper;
import com.graduation.smartparkingplatform.Pojo.Charging;
import com.graduation.smartparkingplatform.Service.ChargingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ChargingServiceImpl implements ChargingService {

  @Autowired ChargingMapper chargingMapper;

  @Override
  // 获取Charging列表（分页）
  public PageInfo<Charging> getChargingList(Integer page, Integer count) {
    PageHelper.startPage(page, count);

    List<Charging> ChargingList = chargingMapper.getChargingList();

    PageInfo<Charging> pageInfo = new PageInfo<>(ChargingList);

    return pageInfo;
  }

  // 精确搜索Charging
  @Override
  public Charging searchCharging(Integer spaceNo) {
    return chargingMapper.searchCharging(spaceNo);
  }

  // 修改停车位信息
  @Override
  public Boolean changeInfo(Charging charging) {

    return chargingMapper.changeInfo(charging);
  }
}
